#ifndef ___MSG_BUILDER__SIMPLE___
#define ___MSG_BUILDER__SIMPLE___


#include "MsgBuilderIf.h"
#include "MsgFactoryIf.h"

//
//	A simple message builder with factory
//
//
class TCOM_API  MsgBuilderWithFactory : public IMsgBuilder
{
public:
	MsgBuilderWithFactory(IMsgFactory* pFact = NULL);
	//
	//	serialize a message into a stream
	//
	virtual bool onEncodeMsg(IMsg* pMsg, MsgOStream& stream);

	//	
	//	de-serialize a message from stream
	//
	virtual bool onDecodeMsg(IMsg*& pMsg, MsgIStream& stream);

	//
	//	create a message base on message category and message id
	//
	IMsg*	createMsg(int nMsgCate, int nMsgID);
protected:
	IMsgFactory*	m_pMsgFact;
};


#endif

